/* ***************************************************** */
/* Arcans Team (2010), website                           */
/* Site under GNU GPL v3 Licence                         */
/* (see NOTICE and COPYING in the of the site file tree) */
/* ***************************************************** */

/* ***************************************************** */
/* module de gestion du voile                            */
/* ***************************************************** */
var voile = (function () {
	var voile_ex; var voile_S_in; var voile_af2; var voile_lg2;
	function init_base_aff () {
		doc.byTAG("body")[0].style.overflow='hidden'; voile_ex.style.display='block'; voile_ex.style.opacity='0';
		for (iter=0;iter<8;iter++) window.setTimeout("voile.voile_ex().style.opacity='0."+iter+"';",(iter+1)*60);
	}
	function init_base_close (temps) {
		for (iter=1;iter<9;iter++) window.setTimeout("voile.voile_ex().style.opacity='0."+(8-iter)+"';",(iter*60)+temps);
		var lastop = "voile.voile_ex().style.display='none';doc.byTAG('body')[0].style.overflow='auto';";
		window.setTimeout(lastop,480+temps);
	}
	function initSaff (choix,id_node) {
		if (choix) init_base_aff();
		voile_lg2.style.display='block'; voile_S_in.style.display='block';
		for (iter=0;iter<12;iter++) {
			var timeout = "voile.voile_lg2().style.opacity='"+(iter/10)+"';";
			window.setTimeout(timeout + "voile.voile_lg2().style.right='"+(390-(iter*30))+"px';",(iter*55)+470);
			window.setTimeout("voile.voile_S_in().style.top='"+(-281+(iter*31))+"px';",(iter*55)+250);
		}
		window.setTimeout("voile.voile_af2().style.display='block';doc.byID('"+id_node+"').style.display='block';",1070);
	}
	function initSclose (choix,id_node,id_after) {
		if(id_node=="enc2_all") while(doc.byID(id_node).hasChildNodes()) doc.byID(id_node).removeChild(doc.byID(id_node).lastChild);
		doc.byID(id_node).style.display = 'none'; voile_af2.style.display = 'none';
		for (iter=0;iter<12;iter++) {
			var timeout = "voile.voile_lg2().style.opacity='"+(1-(iter/10))+"';";
			window.setTimeout(timeout + "voile.voile_lg2().style.right='"+(60+(iter*30))+"px';",50*iter);
			window.setTimeout("voile.voile_S_in().style.top='"+(-31*iter)+"px';",(50*iter)+190);
		}
		window.setTimeout("voile.voile_lg2().style.display='none';",745);
		window.setTimeout("voile.voile_S_in().style.display='none';",745);
		if (choix == 2) init_base_close(470);
		else if (choix == 1) window.setTimeout("voile.initSaff(0,'"+id_after+"');",755);
	}
	return {
		init: function () {
			voile_ex = doc.byID("voile_ex"); voile_S_in = doc.byID("voile_S_in");
			voile_af2 = doc.byID("voile_af2"); voile_lg2 = doc.byID("voile_lg2");
		},
		initSaff: function (choix,id_node) { initSaff(choix,id_node); },
		initSclose: function (choix,id_node,id_after) {initSclose(choix,id_node,id_after); },
		addElt: function (type_elt,attr_tab,parent_elt) {
			var nodec, type_conv;
			switch (type_elt) {
				case "titre" : type_conv = "h5"; break;
				case "stitre" : type_conv = "h6"; break;
				default : type_conv = type_elt; break;
			}
			if (parent_elt == 1) parent_elt = doc.byID("enc2_all");
			var retour =  addNodeFun(type_conv,attr_tab,parent_elt); return retour;
		},
		modElt: function (nodec,attr_tab) { modNodeFun(nodec,attr_tab); },
		suppElt: function (nodec) { supNodeFun(nodec); },
		voile_ex: function () { return voile_ex; }, voile_S_in: function () { return voile_S_in; },
		voile_af2: function () { return voile_af2; }, voile_lg2: function () { return voile_lg2; }
	};
})();